package com.controller;

import com.model.PlacedHospital;
import com.model.PlacedHospitalRelationProduct;
import com.page.GenericPage;
import com.po.*;
import com.result.Result;
import com.service.PlacedHospitalRelationProductService;
import com.service.PlacedHospitalService;
import com.vo.PlacedHospitalRelationProductVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: chihaojie
 * @Date: 2019/5/29 16:11
 * @Version 1.0
 * @Note
 */

@Api(value = "placedHospitalRelationProductApi")
@CrossOrigin
@RestController
@RequestMapping("/PlacedHospitalRelationProduct")
public class PlacedHospitalRelationProductController {

    @Autowired
    private PlacedHospitalRelationProductService placedHospitalRelationProductService;

    @ApiOperation(value = "医院商品实际价格价格 保存或者更新 ", httpMethod = "POST", notes = "医院商品实际价格价格 保存或者更新")
    @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    public Result<Boolean> saveOrUpdate(@RequestBody PlacedHospitalRelationProductSaveOrUpdatePO po) {
         return placedHospitalRelationProductService.saveOrUpdate(po);
    }


    @ApiOperation(value = "医院商品实际价格价格 查询", httpMethod = "POST", notes = "医院商品实际价格价格 查询")
    @RequestMapping(value = "/queryAll", method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    public Result<GenericPage<PlacedHospitalRelationProductVO>>  queryAll(@RequestBody PlacedHospitalRelationProductQueryPO po) {
        return placedHospitalRelationProductService.queryAll(po);
    }

    @ApiOperation(value = "医院商品实际价格价格 根据id查询", httpMethod = "GET", notes = "医院商品实际价格价格 根据id查询")
    @RequestMapping(value = "/queryById", method = RequestMethod.GET)
    public Result<PlacedHospitalRelationProductVO> queryById(@RequestParam Long id) {
        return placedHospitalRelationProductService.queryById(id);
    }
}
